call back function to check user input